home *** CD-ROM | disk | FTP | other *** search
- #ifndef _LGOBJECT_H_
- #define _LGOBJECT_H_
- /*
- * $RCSfile: lgobject.h,v $
- * $Revision: 1.1.1.1 $
- * $Date: 1996/05/04 21:55:20 $
- */
- /**********************************************************************
- * EXODUS Database Toolkit Software
- * Copyright (c) 1991 Computer Sciences Department, University of
- * Wisconsin -- Madison
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * THE COMPUTER SCIENCES DEPARTMENT OF THE UNIVERSITY OF WISCONSIN --
- * MADISON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION.
- * THE DEPARTMENT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES
- * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * The EXODUS Project Group requests users of this software to return
- * any improvements or extensions that they make to:
- *
- * EXODUS Project Group
- * c/o David J. DeWitt and Michael J. Carey
- * Computer Sciences Department
- * University of Wisconsin -- Madison
- * Madison, WI 53706
- *
- * or exodus@cs.wisc.edu
- *
- * In addition, the EXODUS Project Group requests that users grant the
- * Computer Sciences Department rights to redistribute these changes.
- **********************************************************************/
-
-
-
- /*
- * Leaf node format.
- */
- typedef char *LFNODE; /* actual data bytes in leaf */
-
-
- /*
- * Enumeration type for object-enlarging large object operations.
- */
- typedef enum {INSERT, APPEND} OBJOP;
-
-
- /*
- * ------- OPERATION STATE STUFF --------
- */
-
-
- /*
- * define traversal stack entry
- *
- * The shared field indicates if the pointer to this page had
- * the share flag set.
- */
- typedef struct {
-
- PID pid;
- GROUPLINK *nodeLink;
- LGNODE *nodePtr;
- SLOTINDEX slotIndex;
- int dangerCount;
- SLOTINDEX rootSlot;
- BOOL dangerFlag;
- BOOL shared; /* indicates share bit set on ptr to this node*/
- short flags;
-
- } TSTACKENT;
-
-
- /*
- * define the state of root on slotted page or not
- */
- #define LG_SLOTROOT 0x1
-
-
- /*
- * define the maximum depth of the traversal stack
- */
- #ifdef LGTESTING
- # define TSTACKSIZE 100 /* maximum stack size needed */
- #else
- # define TSTACKSIZE 5 /* maximum stack size needed */
- #endif
-
-
- /*
- * Traversal path stack and related information.
- */
- typedef struct {
-
- int top;
- TSTACKENT stack[TSTACKSIZE];
-
- } TSTACK;
-
-
-
-
- typedef enum {LEFTPATH, RIGHTPATH} PATHTYPE;
-
- typedef enum {NONE, CURRENT, KID1, KID2} WHICHNODE;
-
- typedef enum {COLLAPSE, RESHUFFLE, MERGE, LCA_MERGE, LEAFSTUFF} LASTSTEP;
-
-
-
-
- /*
- * Structure and macro for maintaining page lists.
- */
- typedef struct {
-
- int numPages; /* number of pages currently in list */
- int maxPages; /* maximum number of pages list can hold */
- int numBytes; /* sum of byte counts currently in list */
- CHUNKPAGE *pages; /* list of descriptors for pages */
-
- } PAGELIST;
-
- #define FREELIST(pgList) \
- if((pgList)->pages != NULL) {\
- free((char*)(pgList)->pages); (pgList)->pages = NULL;\
- }
-
-
-
- #ifdef JUNK
-
-
- /*
- * Array of operation state records and its free list.
- */
-
- #define OPTABLESIZE 40
-
-
- typedef struct opRecord {
-
- PID rootPid; /* large object's root page id */
- LGNODE *rootPtr; /* indirect buffer ptr for root */
- int start; /* starting offset for desired bytes */
- int length; /* length of desired range of bytes */
- int bfGroup; /* buffer group for accessing data */
- PAGELIST leafPages; /* pageList of relevant leaf pages */
- struct opRecord *nextFree; /* next free opRecord in table */
-
- } OPRECORD;
-
- OPRECORD OpTable[OPTABLESIZE];
-
- OPRECORD *FreeOp; /* pointer to first free opTable entry */
-
-
- #endif
-
-
- /*
- * LGNODELIST is used in destroying versioned large objects. It
- * is a list element containing page id's for nodes.
- */
- typedef struct {
- LISTELEMENT list; /* for storing on lists */
- LISTELEMENT hash; /* for storing in a hash table */
-
- PID pid;
- SLOTINDEX slot;
- } LGNODELIST;
-
-
-
- #define LGNODEHASHTABLESIZE 1024
-
- /*
- * LGNODEHASHTABLE is a hash table for LGNODELIST elements keyed
- * on the pid and slot, but hashed only on the pid.page
- */
- typedef struct {
-
- LIST table[LGNODEHASHTABLESIZE];
- int tableSize;
- unsigned int hashMask;
- } LGNODEHASHTABLE;
-
-
- /*
- * Must define here since page.h isn't included until later.
- */
- #define EQUALPIDS(_a,_b) \
- ((_a).page == (_b).page && (_a).volid == (_b).volid)
-
-
- /*
- * Reset traversal stack.
- */
- #define LG_ResetTstack(_tstack) \
- ((_tstack)->top = -1)
-
-
-
- /*
- * Boolean check for empty tstack.
- */
- #define LG_EmptyTstack(_tstack) \
- ((_tstack)->top < 0)
-
-
-
- /*
- * See if top entry on tstack matches a given pid.
- */
- #define LG_IsTopPid(_tstack, _pid) \
- (((_tstack)->top < 0) \
- ? FALSE \
- : (EQUALPIDS(*(_pid),(_tstack)->stack[(_tstack)->top].pid)))
-
-
- /*
- * Get index of top stack entry.
- */
- #define LG_TopTstackIndex(_tstack) \
- ((_tstack)->top)
-
-
- /*
- * Turn off printing routines if tracing is disabled
- */
- #ifndef DEBUG
-
- #define lg_PrintNode(arg1, arg2, arg3)
-
- #define LG_PrintTstack(arg1)
-
- #define lg_PrintIndex(arg1, arg2, arg3, arg4)
-
- #endif
-
-
-
- /*
- * Error-handling macro (for debugging info, etc.)
- */
- #define LG_ERRCHECK(_errVal) \
- \
- if (_errVal < esmNOERROR) { \
- \
- SM_ERROR(TYPE_WARNING, _errVal); \
- }
-
- #endif /* _LGOBJECT_H_ */
-